import React, { Component } from "react";
import { Switch, Route, Redirect, Link } from "react-router-dom";
import { Menu } from "antd";
import roll from "./roll";
import home from "./home";
import detail from "./detail";
import management from "./management";
import consequence from "./consequence";
class EquipmentAccess extends Component {
  constructor(props) {
    super(props);
    this.state = {
      current: "1",
    };
  }
  handleClick = (e) => {
    console.log("click ", e);
    this.setState({
      current: e.key,
    });
  };
  render() {
    return (
      <div>
        <Menu
          className="nav"
          onClick={this.handleClick}
          selectedKeys={[this.state.current]}
          mode="horizontal"
        >
          <Menu.Item key="1">
            <Link to="/EquipmentAccess">设备管控</Link>
          </Menu.Item>
          <Menu.Item key="2">
            <Link to="/EquipmentAccess/management">策略管理</Link>
          </Menu.Item>
          <Menu.Item key="3">
            <Link to="/EquipmentAccess/roll">黑白名单管理</Link>
          </Menu.Item>
        </Menu>
        <Switch>
          <Route path="/EquipmentAccess" component={home} exact />
          <Route path="/EquipmentAccess/detail" component={detail} />
          <Route path="/EquipmentAccess/management" component={management} />
          <Route path="/EquipmentAccess/roll" component={roll} />
          <Route path="/EquipmentAccess/consequence" component={consequence} />
          <Redirect to="/EquipmentAccess" />
        </Switch>
      </div>
    );
  }
}

export default EquipmentAccess;
